﻿<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Untitled Page" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register TagPrefix="Club" TagName="WebContent" Src="~/UserControls/WebContent.ascx" %>

<%@ Register TagPrefix="Club" TagName="LoginBanner" Src="~/UserControls/LoginBanner.ascx" %>
<%@ Register TagPrefix="Club" TagName="ImageThumbnail" Src="~/UserControls/ImageThumbnail.ascx" %>

<script runat="server">

    Dim IsAdmin As Boolean
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim NumPages As Integer = ClubStarterKit.Web.Events.NumPages(True)
        IsAdmin = User.IsInRole("Administrators")
    End Sub

    Protected Sub UpcommingEventsSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs)
        Dim pages As Integer = ClubStarterKit.Web.Events.NumPages(True)
        pn1.Count = pages
    End Sub

    Protected Sub RecentEventsSource_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs)
        Dim pages As Integer = ClubStarterKit.Web.Events.NumPages(False)
        pn2.Count = pages
    End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div id="body">
    
        <Club:LoginBanner ID="LoginBanner1" runat="server" />
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div id="columnleft">
            <a name="content_start" id="content_start"></a>
            <div class="leftblock">
                <h2>
                    Events</h2>
                <p>
                    <Club:WebContent ID="WebContent1" Section="EventsIntro" runat="server" /><br />
                    <a href="../RSS/EventRss.aspx">
                    <asp:Image ID="rss" runat="server" SkinID="rss" />
                </a>
                </p>
                <div ID="panel1" runat="server" Height="25px" Visible='<%# IsAdmin %>'>
                    <br /><br /><Club:RolloverLink ID="AddBtn" runat="server" Text="Add Event" NavigateURL="add.aspx?Action=New" />
                    <br />
                    <Club:RolloverLink ID="AddReocBtn" Font-Size="X-Small" runat="server" Text="Add Reocurring Event" NavigateURL="addreoc.aspx" />
                </div>
            </div>
        </div>
        
        <div id="columnright">
            <div class="rightblock">
                &nbsp;<a href="calendar.aspx">Month view</a></div>
            <div class="rightblock">
            <h2>Upcoming Events</h2><br />
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                <asp:Repeater ID="Repeater1" runat="server" DataSourceID="UpcomingEventsSource">
                    <ItemTemplate>
                        <div class="listitem">
                            <div class="thumbnail">
                                <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>
                                    <Club:ImageThumbnail ID="ImageThumbnailU" runat="server" PhotoID='<%# Eval("photo") %>' />
                                </a>
                            </div>
                            <asp:panel ID="panel2" runat="server" cssclass="editbuttons" Visible='<%#Isadmin %>'>
                                <Club:RolloverLink ID="EditBtnU" runat="server" Text="Edit" NavigateURL='<%# "Edit.aspx?Action=Edit&id=" & cstr(Eval("id")) %>' />
                                <Club:RolloverLink ID="RemoveBtnU" runat="server" Text="Remove" NavigateURL='<%# "Edit.aspx?Action=delete&id=" & cstr(Eval("id")) %>' />
                                <cc1:ConfirmButtonExtender ID="ConfirmButtonExtenderU" ConfirmText="Are you sure you want to delete this event?" runat="server" TargetControlID="RemoveBtnU"></cc1:ConfirmButtonExtender>
                            </asp:panel>
                            <h3>
                                <asp:Label ID="itemdateLabelU" runat="server" Text='<%# Eval("starttime","{0:d}") %>' />
                                &nbsp;&nbsp;&nbsp;&nbsp; <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>
                                    <asp:Label ID="titleLabelU" runat="server" Text='<%# Eval("title") %>' />
                                </a>
                            </h3>
                            <p>
                                <asp:Label ID="descriptionLabelU" runat="server" Text='<%# truncate(Convert.ToString(Eval("description"))) %>' />
                                <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>read more &raquo;</a></p>
                            <div class="clearlist">
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <br />
                Page: <Club:PageNumberer ID="pn1" runat="server" SelectedPage="1" DisplayedPages="7" CssClass="PageNumbers" />
            <asp:ObjectDataSource ID="UpcomingEventsSource" runat="server" SelectMethod="UpcomingList" TypeName="ClubStarterKit.Web.Events" OnSelecting="UpcommingEventsSource_Selecting">
                <SelectParameters>
                    <asp:ControlParameter Name="pagenum" ControlID="pn1" PropertyName="SelectedPage" />
                </SelectParameters>
            </asp:ObjectDataSource>
            </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                <ProgressTemplate>
                    <asp:Image ID="Loading1" SkinID="loading" runat="server" />
                </ProgressTemplate>
                </asp:UpdateProgress>
            </div>
            <div class="rightblock">
            <h2>Recent Events</h2><br />
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                <asp:Repeater ID="Repeater2" runat="server" DataSourceID="RecentEventsSource">
                    <ItemTemplate>
                        <div class="listitem">
                            <div class="thumbnail">
                                <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>
                                    <Club:ImageThumbnail ID="ImageThumbnailR" runat="server" PhotoID='<%# Eval("photo") %>' />
                                </a>
                            </div>
                            <asp:panel ID="panelR" runat="server" cssclass="editbuttons" Visible='<%#Isadmin %>'>
                                <Club:RolloverLink ID="EditBtnR" runat="server" Text="Edit" NavigateURL='<%# "Edit.aspx?Action=Edit&id=" & cstr(Eval("id")) %>' />
                                <Club:RolloverLink ID="RemoveBtnR" runat="server" Text="Remove" NavigateURL='<%# "Edit.aspx?Action=delete&id=" & cstr(Eval("id")) %>' />
                                <cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" ConfirmText="Are you sure you want to delete this event?" runat="server" TargetControlID="RemoveBtnR"></cc1:ConfirmButtonExtender>
                            </asp:panel>
                            <h3>
                                <asp:Label ID="itemdateLabelR" runat="server" Text='<%# Eval("starttime","{0:d}") %>' />
                                &nbsp;&nbsp;&nbsp;&nbsp; <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>
                                    <asp:Label ID="titleLabelR" runat="server" Text='<%# Eval("title") %>' />
                                </a>
                            </h3>
                            <p>
                                <asp:Label ID="descriptionLabelR" runat="server" Text='<%# truncate(Convert.ToString(Eval("description"))) %>' />
                                <a href='<%# "view.aspx?Eventid=" &Cstr( Eval("ID"))%>'>read more &raquo;</a></p>
                            <div class="clearlist">
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
                <br />
                Page: <Club:PageNumberer ID="pn2" runat="server" SelectedPage="1" DisplayedPages="7" CssClass="PageNumbers" />
            <asp:ObjectDataSource ID="RecentEventsSource" runat="server" SelectMethod="RecentList" TypeName="ClubStarterKit.Web.Events" OnSelecting="RecentEventsSource_Selecting">
                <SelectParameters>
                    <asp:ControlParameter Name="pagenum" ControlID="pn2" PropertyName="SelectedPage" />
                </SelectParameters>
            </asp:ObjectDataSource>
            </ContentTemplate>
                </asp:UpdatePanel>
                <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
                <ProgressTemplate>
                    <asp:Image ID="loading2" SkinID="loading" runat="server" />
                </ProgressTemplate>
                </asp:UpdateProgress>
            </div>
        </div>
        
    </div>
</asp:Content>